1. Field of the Invention
This application relates generally to microcontrollers, and more particularly to jitter free execution of instructions.
2. Description of the Related Art
A modem semiconductor microcontroller is basically a low-cost computer adapted to provide rapid solutions to external events after intensive computation. The microcontroller senses the occurrence of external events through input ports and provides solutions through output ports after computation in a Central Processing Unit (CPU). The CPU usually operates in conjunction with on-chip peripherals to achieve this. The typical microcontroller also has an on-chip program ROM to store its instructions, an on-chip data RAM to store data, an oscillator driver to generate the system clock and application specific peripherals such as timers, analog comparators, and others.
Microcontrollers are used in various applications. Many households have over a hundred of them. For example, they are used in microwave ovens, TVs, calculators, remote controls, clocks, security alarm systems, toys, refrigerators, radios, stereo systems, telephones, and elsewhere.
Microcontrollers often receive input, from the user or otherwise, and produce a corresponding desired output according to its instructions. For instance, in a microwave oven, a microcontroller senses keyed input from the user and heats food for the selected interval and power level. The microcontroller also tracks the real time and variously notifies the user, such as via an audible alarm upon the completion of heating.
In certain applications, microcontrollers are embedded in control systems. For example, they are used to control manufacturing machines in assembly lines. Also, numerous microcontrollers are used in automobiles, to provide functions such as controlling anti-lock brakes.
Microcontrollers control and sense many timing sensitive events. Thus, to optimize operation, microcontrollers should execute instructions in a predictable, predefined time period. For example, in generating a sine wave, an output pin voltage should be updated at certain fixed intervals depending on the targeted frequency. If the update interval is not fixed, then the quality of the produced sine wave will degrade. Similarly, provision of fixed intervals on the input side can ensure accurate measurement.
Several factors can affect the amount of time required for executing a set of instructions. If this amount of time is not known to the programmer, or is not precisely predictable, there can be an adverse impact on various operations, such as the above-mentioned timing sensitive operations. One factor that affects the amount of time is whether the number of cycles required to execute an instruction is consistent. Also, the response to branch instructions and interrupts affects the amount of time required for executing a set of instructions. Further, for a modern multi-tasking microcontroller, the time allocated to the execution of the various tasks, as well as the branch and interrupt response times, can adversely affect various timing sensitive operations and events. The uncertainty regarding the duration of execution for a segment of instructions, or the time for responding to a branch or interrupt, can be referred to as jitter.
There remains a need for jitter free execution of instructions, particularly for multi-tasking microcontrollers.